package com.zackeus.mvvm.base;

import androidx.lifecycle.LifecycleService;

import com.trello.lifecycle4.android.lifecycle.AndroidLifecycle;

import io.reactivex.rxjava3.core.Observable;

/**
 * @name: BaseService
 * @author: zz
 * @date: 2022/9/19
 */
public class BaseService extends LifecycleService {

    /**
     * Observable 注册
     * @param observable
     * @param <T>
     * @return
     */
    public <T> Observable<T> doObservable(Observable<T> observable) {
        return observable.compose(AndroidLifecycle.createLifecycleProvider(this).bindToLifecycle());
    }

}
